package com.cyj.dream.captcha.model.enums;

import lombok.Getter;
import lombok.RequiredArgsConstructor;

/**
 * @Description: 标识符
 * @BelongsProject: DreamChardonnay
 * @BelongsPackage: com.cyj.dream.captcha.model.enums
 * @Author: ChenYongJia
 * @CreateTime: 2021-09-27 12:57
 * @Email: chen87647213@163.com
 * @Version: 1.0
 */
@Getter
@RequiredArgsConstructor
public enum Symbol {

    /**
     * 标识符
     */
    NUM('n', false),
    ADD('+', false),
    SUB('-', false),
    MUL('x', true),
    DIV('÷', true);

    private final char value;

    private final boolean priority;

    public static Symbol of(char c) {
        Symbol[] values = Symbol.values();
        for (Symbol value : values) {
            if (value.value == c) {
                return value;
            }
        }
        throw new IllegalArgumentException("不支持的标识符，仅仅支持(+、-、×、÷)");
    }

}
